iris-gui: port live MIPS estimate to CyclesPtr - #77
Merged
Conversation
926d56f converted REX3's cycle counter from Arc<AtomicU64> to a Cell<CyclesPtr> volatile read but only updated src/, leaving iris-gui/src/handle.rs on the old API and the GUI build broken: error[E0308]: mismatched types --> iris-gui/src/handle.rs:409:34 | expected `Option<Arc<Atomic<u64>>>`, found `Option<Cell<CyclesPtr>>` Latch the CyclesPtr instead of cloning an Arc and read it with .get(), mirroring REX3's own refresh thread in src/rex3.rs. CyclesPtr is Copy, so the Option no longer needs .as_ref(); .get() is null-safe, and the existing Stop/SyncDisks paths already clear it to None.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates iris-gui to match the emulator core’s newer cycle-counter plumbing by switching the GUI’s live MIPS estimate from an Arc<AtomicU64>-based counter to the mips_core::CyclesPtr pointer-based counter used by REX3.
Changes:
- Replace the GUI worker-loop cached cycle counter type from
Option<Arc<AtomicU64>>toOption<iris::mips_core::CyclesPtr>. - Update the periodic MIPS-estimate refresh logic to read cycles via
CyclesPtr::get()instead ofAtomicU64::load(Ordering::Relaxed). - Latch the cycle counter from REX3 via
r.cycles.get()(copying the pointer value out of theCell) and initializeprev_cyclesviaCyclesPtr::get().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Owner
|
oh crap. sorry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
iris-guidoesn't compile on currentmain:926d56f ("convert cycles atomic into regular volatile variable") changed
Rex3::cyclesfromArc<AtomicU64>toCell<CyclesPtr>across 11 files undersrc/, butiris-gui/wasn't updated. The GUI's worker loop uses that counter for its live MIPS estimate, so it was still calling.clone()on theArcand.load(Ordering::Relaxed)to read it.The CLI (
iris,iris-ci) builds fine — only the GUI is affected.Fix
Latch the
CyclesPtrby value rather than cloning anArc, and read it with.get():This mirrors REX3's own refresh thread at
src/rex3.rs:3863(self.cycles.get().get()—Cell::getfor the pointer, thenCyclesPtr::getfor the count).Notes on correctness:
CyclesPtrisCopy/Send/Syncand its doc comment names cross-thread status displays as the intended consumer, valid for the process lifetime. The GUI's MIPS readout is exactly that — it exists because the GUI never runs REX3's own refresh/status-bar loop.Copy, theOptionno longer needs.as_ref()..get()is null-safe (returns 0 while dangling), and the pointer is already wired up by the time the GUI latches it, since that happens afterMachine::newreturns.Stop/SyncDiskspaths already resetcycles = Nonebefore the machine is dropped, so no dangling read.Testing
./build.shon macOS arm64 (rustc 1.99.0-nightly), CLI featureslightning,rex-jit,tlbvmap,idle-pauseand GUI featuresiris/lightning,iris/idle-pause: all three binaries build clean. No new warnings.